package com.hp.controller;

import com.hp.entity.Effect;
import com.hp.service.EffectService;
import com.hp.util.JsonData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Date;

@Controller
@RequestMapping("/effect")
public class EffectController {
    @Resource
    EffectService effectService;

    /**
     * 添加药物功效
     */
    @RequestMapping("/add")
    @ResponseBody
    public Object add(Effect obj){
        Date date = new Date();
        obj.setCreate_datetime(date);
        int i = effectService.add(obj);
        System.out.println(i);
        return JsonData.buildSuccess(i>0?"添加成功！":"添加失败！");

    }
}
